<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>watch监听</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="input">{{value}}
    </div>
    <script src="../js/vue.js"></script>
    <script>
        //去除警告
        Vue.config.productionTip = false; 

        let vue = new Vue({
            el:"#app",
            data:{
                msg:"tianyi",
                input:"",
                value:""
            },
            methods: {
                
            },
            watch:{
                input(val,oldval){
                    console.log(val);
                    console.log(oldval);
                    this.value = val+1;
                }
            }
            
        })
    </script>
</body>
</html>